﻿using System;
using System.Text.RegularExpressions;

class Ex7URLExtractor
{
    static void Main()
    {
        string text = "Here are : some : @ ! url with http or without and some : abv.bg is this a url? " +
            "here is a valid url http://regexlib.com/DisplayPat/terns.aspx?cattabindex=1&categoryId=2 "+
            "http://www.codeplex.com";
        string pattern = @"(http://)?(www\.)?([\w\&\?=-]+\.)+[A-z]{2,4}((\/([\w\&\?=-]+)(\.[\w\&\?=-]+)*)*)?";
        foreach (var match in  Regex.Matches(text, pattern))
        {
            Console.WriteLine(match);
        }      
    }
}

